const weekName = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
export const getNowTime = () => {
  var datetime = new Date();
  const year = datetime.getFullYear()
  const month = datetime.getMonth() + 1 < 10 ? '0' + (datetime.getMonth() + 1) : datetime.getMonth() + 1
  const date = datetime.getDate() < 10 ? '0' + datetime.getDate() : datetime.getDate()
  // const hour = datetime.getHours() < 10 ? '0' + datetime.getHours() : datetime.getHours()
  // const minute = datetime.getMinutes() < 10 ? '0' + datetime.getMinutes() : datetime.getMinutes()
  // const second = datetime.getSeconds() < 10 ? '0' + datetime.getSeconds() : datetime.getSeconds()
  const week = datetime.getDay();
  return year + '/' + month + '/' + date + ' ' + weekName[week];
}
/**
 * 
 * @param {*时间戳} start 
 * @param {*时间戳} end 
 */
export const getDurTime = (start, end) => {
  var startTime = `${new Date(start).getHours()}:00`;
  var endTime = `${new Date(end).getHours()}:00`;
  return `${startTime}~${endTime}`

}
/**
 * 秒变小时
 * @param {*秒} time 
 * @param {*保留小数位} time 
 */
export const fromMSToH = (time, num = 0) => {
  return `${(time / 3600000).toFixed(num)}`

}